<template>
   <a-spin :spinning="confirmLoading">
              <a-form-model ref="form" :model="models" :rules="validatorRules">
                <a-form-model-item
                  :labelCol="labelCol"
                  :wrapperCol="wrapperCol"
                  prop="productDescribe"
                  required
                  label="产品描述"
                >
                  <a-textarea :rows="5" v-model="models.productDescribe" placeholder="请输入产品描述" />
                </a-form-model-item>
                <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="generNumber" required label="生成条数">
                  <a-input placeholder="请输入生成条数要求" disabled="disabled" v-model="models.generNumber" />
                </a-form-model-item>
              </a-form-model>
            </a-spin>
</template>

<script>
// import IndexChart from './IndexChart'
// import IndexTask from "./IndexTask"
// import IndexBdc from './IndexBdc'
import { mapGetters } from 'vuex'
import { sessionNoteList } from '@/api/api'
import { deleteAction } from '@/api/manage'
export default {
  name: 'WorkPlan',
  components: {
    // IndexChart,
    // IndexTask,
    // IndexBdc
  },
  props: {
      model: {
        type: Object,
        default: {}
      },
    },
  data() {
    return {


      models: this.model,
      confirmLoading: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 },
      },
      validatorRules: {
        productDescribe: [{ required: true, message: '请输入产品描述' }],
        generNumber: [{ required: true, message: '请输入生成条数' }],
      },
      
    }
  },
  created() {},
  computed: {
    models1() {
      return this.models
    },
  },
  watch: {
    models1: {
      handler(newVal, oldVal) {
        // console.log('newVal + oldVal',newVal, oldVal)
        // console.log('handler',newVal,  this.model)
        if (!newVal.generNumber) {
          //只需判断一个即可
          this.model.generNumber = '10'
        }
      },
      deep: true,
      immediate: true,
    },
  },


  mounted() {
  },
  methods: {
    generatedBtnProp() {
      let obj = {
        productDescribe:this.models.productDescribe,
        generNumber:this.models.generNumber,
      }
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$emit('appApiAsk', 1,obj)
        } else {
          this.$emit('appApiAsk', 2,obj)
        }
      })
    },

  },
}
</script>

<style lang="less">

</style>